package com.java.yz.day13.ketang;

import java.io.*;

/*字符流（转换流）=字节流+编码表
    OutputStreamWriter 字符输出流
        public OutputStreamWriter(OutputStream out)
        public OutputStreamWriter(OutputStream out,String charsetName)


    InputStreamReader 字符输入流
        public InputStreamReader(InputStream in)
        public InputStreamReader(InputStream in,String charsetName)

 */
public class OutputStreamWriterDemo1 {
    public static void main(String[] args) {

        //public OutputStreamWriter(OutputStream out)
        //第一种构造方法  传入一个OutputStream的具体实现子类
        OutputStreamWriter osw = null;
        try {
            //osw = new OutputStreamWriter(new FileOutputStream("src/com/java/yz/day13/ketang/d.txt",true));


            //第二种写法就是在后面加一个编码
            osw = new OutputStreamWriter(new FileOutputStream("src/com/java/yz/day13/ketang/d.txt",true),"GBK");
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                osw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
